package com.shiyo.spring.basic_di.a_setter;

import com.shiyo.spring.basic_di.a_setter.bean.Cat;
import com.shiyo.spring.basic_di.a_setter.bean.Person;
import com.shiyo.spring.basic_di.a_setter.config.BeanConfig;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class QuickstartInjectBySetApplication {
    public static void main(String[] args) {
        BeanFactory factory = new ClassPathXmlApplicationContext("basic_di/a-setter.xml");
        Person person = (Person) factory.getBean("person");
        System.out.println(person);

        BeanFactory factory1 = new AnnotationConfigApplicationContext(BeanConfig.class);
        Cat cat = (Cat) factory1.getBean("cat");
        System.out.println(cat);
    }
}
